2 Returns the closest distance between point pnt and the line
3 that passes through points a and b
5 http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/
7 double distance_point_to_line(const point
&a
, const point
&b
,
10 ((pnt
.x
- a
.x
)*(b
.x
- a
.x
)+(pnt
.y
- a
.y
)*(b
.y
- a
.y
))
13 intersection
.x
= a
.x
+ u
*(b
.x
- a
.x
);
14 intersection
.y
= a
.y
+ u
*(b
.y
- a
.y
);
15 return dist(pnt
, intersection
);